const path = require('path');
// 引入html5模板插件
const HtmlWebpackPlugin = require('html-webpack-plugin')
// 引入进度条插件
const ProgressBarPlugin = require('progress-bar-webpack-plugin')
module.exports = {
    entry: './src/app.js',
    output: {
        path: path.resolve(__dirname, 'dist'),
        // filename: 'bundle.js',
    },

    // 使用插件引入模板index.html并在dist下生成一个index.html文件
    plugins: [
        new HtmlWebpackPlugin({
            template: path.resolve(__dirname, './index.html'),
            filename: 'index.html'
        }),
        new ProgressBarPlugin({
            complete: '█',
        }),
    ],
    module: {
        rules: [
            {
                test: /\.css$/,
                use: ['style-loader', 'css-loader'], //从右向左解析
            },
        ],
    },
};